<?php
	$title = 'Module Manager';
	$this->headTitle($title);
	
?>

<h1><?php echo $this->escapeHtml($title); ?></h1>
<p>
	<a href="<?php echo $this->url('module/process', array('controller'=>'upload', 'action'=>'index'));?>">Install new module</a>
</p>

<table class="table">
	<tr>
		<th>Key name</th>
		<th>Module Name</th>
		<th>Description</th>
                <th>Group</th>
		<th>State</th>
		<th></th>
	</tr>
	<?php foreach ($this->moduleArray as $row) : ?>
	<tr>
		<td><?php echo $this->escapeHtml($row['key_name']);?></td>
		<td><?php echo $this->escapeHtml($row['name']);?></td>
		<td><?php echo $this->escapeHtml($row['description']);?></td>
                <td><?php echo $this->escapeHtml($row['module_group_id']);?></td>
		<td><?php echo $this->escapeHtml($row['state']);?></td>
		<td>
                    <a href="<?php echo $this->url('module/process',	array('controller' => 'modulesusers', 'action' => 'register'), array('query' => array('id' => $row['mid']))); ?>">Register</a> | 
                    <a href="<?php echo $this->url('module/process',	array('controller' => 'index', 'action' => 'config'), array('query' => array('id' => $row['mid']))); ?>">Config</a> |
                    <a href="<?php echo $this->url('module/process',	array('controller' => 'index', 'action' => 'changeGroup'), array('query' => array('id' => $row['mid'], 'group_id' => $row['module_group_id']))); ?>">Change group</a> | 
                    <a href="<?php echo $this->url('module/process',	array('controller' => 'index', 'action' => 'uninstall'), array('query' => array('id' => $row['mid']))); ?>">UnInstall</a> 
		</td>
		
	</tr>
	<?php endforeach; ?>
</table>

<?php echo ( count($this->moduleArray) > 0 ) ? $this->paginationControl($this->moduleArray, 'Sliding', 'pager.phtml') : ""; ?>